package com.sincon.web.controller.bilibili;

import com.sincon.core.config.AvatarConfig;
import com.sincon.system.domain.User;
import com.sincon.system.service.impl.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

@Controller
public class UserController {
    
    @Autowired
    private UserService userService;
    
    @GetMapping("/user/{id}")
    public String getUserProfile(@PathVariable Long id, Model model) {
        // 获取用户信息
        User user = userService.getUserById(id);
        model.addAttribute("user", user);
        
        // 获取随机头像
        String avatarUrl = AvatarConfig.getRandomAvatar();
        model.addAttribute("avatarUrl", avatarUrl);
        
        return "user-profile";
    }
} 